package hooks

import (
	"github.com/sirupsen/logrus"
	"micro-grpc-server/library/logger/reports"
)

type DefaultHook struct {
	levelList []logrus.Level
	report    reports.Report
}

func NewDefaultHook(report reports.Report, levels ...logrus.Level) DefaultHook {
	return DefaultHook{
		levelList: levels,
		report:    report,
	}
}

func (h DefaultHook) Levels() []logrus.Level {
	return h.levelList
}

func (h DefaultHook) Fire(entry *logrus.Entry) error {
	return h.report.Report(entry)
}
